;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;hello-world.lisp
;;
;;  copyright © 1987-89 Apple Computer
;;
;;
;;  this file creates a very simple application.
;;
;;  the application just puts up a dialog with two buttons
;;  clicking the Hello button beeps
;;  clicking the Goodbye button quits
;;
;;


(defun hello-world ()
  (modal-dialog
   (oneof *dialog*
          :window-type :double-edge-box
          :window-size #@(170 35)
          :window-position (make-point (ash (- *screen-width* 170) -1) 100)
          :dialog-items
          (list
           (oneof *button-dialog-item*
                  :dialog-item-text " Hello "
                  :dialog-item-position #@(10 10)
                  :dialog-item-size #@(75 16)
                  :dialog-item-action #'ed-beep)
           (oneof *button-dialog-item*
                  :dialog-item-text " Goodbye "
                  :dialog-item-position #@(95 10)
                  :dialog-item-size #@(75 16)
                  :dialog-item-action #'(lambda ()
                                          (%set-toplevel nil)
                                          (return-from-modal-dialog nil)))))))

(progn
  (dolist (m (menubar))
    (ask m (menu-dispose)))
  (save-application (choose-new-file-dialog :pathname "Hello World")
                    :toplevel-function #'hello-world))
